package com.sagframe.sagacity.sqltoy.plus.multi.delete;

import com.sagframe.sagacity.sqltoy.plus.conditions.eumn.SqlKeyword;
import com.sagframe.sagacity.sqltoy.plus.multi.AbstractLambdaMultiWrapper;
import com.sagframe.sagacity.sqltoy.plus.multi.MultiContext;
import com.sagframe.sagacity.sqltoy.plus.multi.LambdaMultiStepWrapper;

public class LambdaMultiDeleteWrapper extends AbstractLambdaMultiWrapper<LambdaMultiDeleteWrapper> implements LambdaDelete<LambdaMultiDeleteWrapper> {

    public LambdaMultiDeleteWrapper() {
        super((Class<?>)null);
        context.addOperateSqlSegment(SqlKeyword.DELETE);
    }

    public LambdaMultiDeleteWrapper(MultiContext context) {
        super(context);
    }

    @Override
    public LambdaMultiStepWrapper.LambdaFrom<LambdaMultiDeleteWrapper> delete(Class<?>... classes) {
        if (classes != null && classes.length > 0) {
            for (Class<?> clazz : classes) {
                context.addDeleteSqlAssembler(clazz);
            }
        }
        return new LambdaMultiStepWrapper.MultiStepWrapperBuilder<>(typedThis, context);
    }

    @Override
    protected LambdaMultiDeleteWrapper instance() {
        return new LambdaMultiDeleteWrapper(context);
    }
}
